package IC.AST.nodes;

import IC.AST.*;

/**
 * a binary expression
 */
public class BinaryExpr extends Expression {
	private Expression left;	// the left operand
	private Operator op;	// the operator
	private Expression right;	// the right operand

	/**
	 * @param left the left operand
	 * @param opCode the operator
	 * @param right the right operand
	 * @param line the node line number
	 * @param column the node column number
	 */
	public BinaryExpr(Expression left, Operator op, Expression right, int line, int column) {
		super(line,column);
		this.left = left;
		this.op = op;
		this.right = right;
	}

	/**
	 * @return the left operand
	 */
	public Expression getLeft() {
		return this.left;
	}

	/**
	 * @return the operator
	 */
	public Operator getOp() {
		return this.op;
	}

	/**
	 * @return the right operand
	 */
	public Expression getRight() {
		return this.right;
	}

	public Object accept(Visitor v) {
		return v.visit(this);
	}
}
